﻿using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PSIMIS2019.Comm
{
    public class DataBinding
    {
        /// <summary>
        /// 供应商下拉菜单
        /// </summary>
        public static void SupplierComboBox(ComboBox controlName)
        {
            List<Supplier> sList = new List<Supplier>();
            sList = new SupplierBLL().GetList();
            //var s1 = sList.Select(x => new { x.SupplierID, x.SupplierName });//Lambda表达式
            //controlName.DataSource = s1.ToArray();
            //controlName.DisplayMember = "SupplierName";
            //controlName.ValueMember = "SupplierID";
            controlName.DataSource = sList.ToArray();
            controlName.DisplayMember = "SupplierName";
            controlName.ValueMember = "SupplierID";
        }
    }
}
